/**
 * 
 */
package com.taobao.wolfwolf.hibernate.service.impl;

import java.util.List;

import com.taobao.wolfwolf.hibernate.dao.UnitDao;
import com.taobao.wolfwolf.hibernate.pojo.Unit;
import com.taobao.wolfwolf.hibernate.service.UnitService;

/**
 * @author Tux
 *
 * 创建时间: 2011-5-13 上午08:35:14
 */
public class UnitServiceImpl extends BaseServiceImpl implements UnitService {
	private UnitDao udao;

	public List<Unit> findAll() {
		try {
			return udao.findAll();
		} catch(Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public Unit findById(int id) {
		try {
			return udao.findById(id);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findById(int id)");
		}
		return null;
	}

	public List<Unit> findByName(String name) {
		try {
			return udao.findByName(name);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findByName(String name)");
		}
		return null;
	}

	public long getTotal()  {
		try {
			return udao.getTotal();
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at getTotal()");
		}
		return -1;
	}

	public List<Unit> paging(int page, int limit)  {
		try {
			return udao.paging(page, limit);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at paging(int page, int limit)");
		}
		return null;
	}

	public void setudao(UnitDao udao) {
		this.udao = udao;
	}

	public UnitDao getudao() {
		return udao;
	}
}
